package com.example.content.fragment.main

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.content.R
import com.example.content.REMD_ALL
import com.example.content.REMD_FEMAIL
import com.example.content.REMD_MAN
import com.example.content.adapter.viewpager.HomePagerAdapter
import com.example.content.databinding.FragmentHomeBinding
import com.example.content.fragment.BaseMvvmFragment
import com.example.content.fragment.CommonListFragment
import com.example.content.viewmodule.main.CommonHomeViewModel

/**
 * A simple [Fragment] subclass.
 * Use the [CityFragment.newInstance] factory method to
 * create an instance of this fragment.
 */
class CityFragment() :  BaseMvvmFragment<FragmentHomeBinding, CommonHomeViewModel>() {
    private val fragments = mutableListOf<Fragment>()

    private val titles = arrayOf("看美女","看帅哥")

    override fun initView() {
        dataBinding.search.visibility = View.GONE
        fragments.add(CommonListFragment.newInstance(REMD_FEMAIL, true))
        fragments.add(CommonListFragment.newInstance(REMD_MAN, true))
        dataBinding.viewPager.adapter = HomePagerAdapter(childFragmentManager, fragments, titles)
        dataBinding.slidingTab.setViewPager(dataBinding.viewPager, titles)
    }

    companion object {
        @JvmStatic
        fun newInstance() = CityFragment()
    }

    override fun getViewModuleClass() = CommonHomeViewModel::class.java

    override fun getLayoutId() = R.layout.fragment_home
}